<template>
	<view>
		<!-- 医生科普 -->
		<view v-for="(item,index) in dataSource" :key="index">
			<view class="between center mar-10-0" @click="toPage(item)">
				<view>
					<view class="font-weight font-size-15">{{item.name}}</view>
					<view class="color-gray">{{item.createTime}}</view>
				</view>
				<view class="flex-start">
					<view class="text-center mar-0-5">
						<u-icon name="thumb-up-fill"></u-icon>
						<view>{{item.likes}}</view>
					</view>
					<view class="text-center">
						<u-icon name="star-fill"></u-icon>
						<view>{{item.collects}}</view>
					</view>
				</view>
			</view>
		</view>
		<view v-if="dataSource && dataSource.length==0">
			当前医生还没有发布科普资讯
		</view>
	</view>
</template>

<script>
	import {
		doctorScienceInfoSelect
	} from '../../api/doctorScienceInfo';
	export default {
		props: {
			doctorCode: String,
		},
		data() {
			return {
				dataSource: [],
				page: 1,
				size: 10,
			}
		},
		mounted() {
			this.init();
		},
		methods: {
			init() {
				doctorScienceInfoSelect({
					doctorCode: this.doctorCode,
					page: this.page,
					size: this.size
				}).then(res => {
					console.log(res)
					this.dataSource = res;
				})
			},
			toPage(item) {
				uni.navigateTo({
					url: `/pages/Introduce/doctorScienceInfoDetail?item=` + JSON.stringify(item)
				})
			}
		}
	}
</script>

<style>
</style>